package com.ysd.crm.utils;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@Component
public class LayResult {
	@Autowired
//	private static Gson t = new Gson();
	private static Gson t = new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss").create();
	
	public String code;//0,1
	public String msg;
	public Integer count;
	public Object data;
	public static String toClient(String code,String msg){
		LayResult r = new LayResult();
		r.code =code;
		r.msg = msg;
		r.count=0;
//		Gson t = new Gson();
		return t.toJson(r);
	}
	public static String toClient(String code,String msg,Integer count,Object data){
		LayResult r = new LayResult();
		r.code =code;
		r.msg = msg;
		r.count=count;
		r.data = data;
//		Gson t = new Gson();
		return t.toJson(r);
	}	
}
